package com.briup.gsauestore.dao;

import com.briup.gsauestore.bean.Shop;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import javax.transaction.Transactional;
import java.util.List;

/**
 * @author adam
 * @date  2022/1/12
 */
@Repository
public interface IShopDao extends JpaRepository<Shop, Long> {

//    根据是否特价作为查询依据
    List<Shop>  findByDiscount(boolean discount);

    @Query(nativeQuery = true,value = "select  *  from t_shop  order by sales_volume limit 10")
    List<Shop>  findTop10BySalesVolume();

    List<Shop> findByNameContaining(String name);

    List<Shop>  findByCategoryId(Long categoryId);

}
